package com.hhit.zhgd.domain.response

data class BaseResp<T>(val code:Int,val msg:String?,val data:T) {
    companion object {
        fun <T> success(data:T?):BaseResp<T?> {
            return BaseResp(200,"请求成功",data)
        }
        fun success():BaseResp<Any?> {
            return BaseResp(200,"请求成功",null)
        }

        fun <T> fail(code:Int,msg:String,data:T):BaseResp<T> {
            return BaseResp(code,msg,data)
        }
        fun fail(code:Int,msg:String):BaseResp<Any?> {
            return BaseResp(code,msg,null)
        }
        fun fail(msg:String?):BaseResp<Any?> {
            return BaseResp(500,msg,null)
        }
        fun fail():BaseResp<Any?> {
            return BaseResp(500,"请求失败",null)
        }
    }
}
